a = input()
flag = True
b = []
for char in a:
    if char in '([{<':
        b.append(char)
    elif char in ')]}>':
        if not b:
            flag = False
            break
        elif ord(char) - ord(b[-1]) in (1, 2):
            b.pop()
        else:
            flag = False
            break

if flag and not b:
    print("Yes")
else:
    print("No")
